import { reqCategoryList } from "@/api"
import { reqBanners,reqFloors } from "@/api"
const home = {
    state: {
        categoryList:[],
        bannerList:[],
        floorList:[]
    },
    mutations: {
        GETCATEGORYLIST(state,data){
            state.categoryList=data
        },
        GETBANNERLIST(state,data){
            state.bannerList=data
        },
        GETFLOORLIST(state,data){
            state.floorList=data
        }
    },
    actions: {
        async getCategoryList(context){
            let res=await reqCategoryList()
            if(res.code===200)context.commit('GETCATEGORYLIST',res.data.slice(0,16))
        },
        async getBannerList(context){
            let res=await reqBanners()
            if(res.code===200)context.commit('GETBANNERLIST',res.data)
        },
        async getFloorList(context){
            let res=await reqFloors()
            if(res.code===200)context.commit('GETFLOORLIST',res.data)
        }
    },
    getters: { }
}
export default home